﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Expand.Collections
{
    public static class IListExtension
    {
        public static void Swap(this IList list, int index1, int index2)
        {
            if (index1 < 0 || index2 < 0 || index1 >= list.Count || index2 >= list.Count) throw new ArgumentOutOfRangeException("index1 and index2");

            object tmp = list[index1];
            list[index1] = list[index2];
            list[index2] = tmp;
        }
    }
}
